<template>
<div id="region_sort_mm">

<mycity v-if="field.fval" @setVo='toSetEditVo' :param="param" :field="field" 
                           :editType="editType" ></mycity>

<button  type="submit" class="ui button" @click="mysubmit">提 交</button>
</div>
</template>
<script type="text/ecmascript-6">
import mycity from 'components/field/city'
import util from '_util/index';
import tool from 'src/util/tool'


export default {
  data() {
    return {
	field:{
	    title:'区域排序',
	    city_type:1,
	    city_need_all:0,
	    name:'region_sort',
	    fval:null,//城市列表
	},
	param:{
	    in_zip_inline:true,
	    
	},
	editType:'editType_1000'
	
    }
  },
  methods: {

       toSetEditVo(name, val) {
        let evnetName =  'setEditVo'
        let voName =   'editVo'

        let vo = this.$store.state.global[voName]
        vo[name] = val;
        this.$store.commit(evnetName, vo);
      },
      //提交
      mysubmit(){
	  
	  let url=tool.getApi(this, 'region_sort','insert','user');
	  let vo={}
	  
	  vo.list=this.$store.state.global['editVo']['region_sort']
	  util.getDataCom(this, url, vo, (rs) => {
              util.showMsg(this, 'success', '操作成功！')
              
          }, (data, msg)=> {
              msg = data && data.length > 1 ? `${data.errmsg}(${data.debug})` : msg;
              util.showMsg(this, 'error', msg);
          });

      }
  },
  watch: {

      
  },
  components: {
    mycity
  },
  computed: {
      
  },
  props:  [],
  mounted() {
    
  },
    created() {

        let url=tool.getApi(this, 'region_sort','index','user');
        let vo={}
        
	
        util.getDataCom(this, url, vo, (rs) => {
	    
            this.field.fval=rs
	    
	    
        }, (data, msg)=> {
            msg = data && data.length > 1 ? `${data.errmsg}(${data.debug})` : msg;
            util.showMsg(this, 'error', msg);
        })



    }
};
</script>

<style rel="stylesheet/less" lang="less" scoped>
  @import "../../common/style/mixin";
  
#region_sort_mm{
    padding-left: 30%;
}
</style>
